package cn.rdq.iknesssystem.controller;

import cn.rdq.api.dto.BlogShowDto;
import cn.rdq.api.vo.BlogVo;
import cn.rdq.common.CommonResult;
import cn.rdq.iknesssystem.service.BlogService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/blog")
@Api
public class BlogController {

    @Autowired
    private BlogService blogService;

    @PostMapping("/list")
    public CommonResult list(@RequestBody BlogVo blogVo) {
        List<BlogShowDto> listBlog = blogService.listBlog(blogVo);
        return CommonResult.success().pageSuccess(listBlog);
    }

    @GetMapping("/del/{id}")
    public CommonResult delete(@PathVariable Long id) {
        blogService.removeById(id);
        return CommonResult.success();
    }


}
